package auto;

import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-04-08
 * Time: 20:45
 */
public class AutoDemo4 {

    public void script() throws InterruptedException {
        EdgeOptions options = new EdgeOptions();
        options.addArguments("--remote-allow-origins=*");
        EdgeDriver driver = new EdgeDriver(options);


        driver.get("https://www.baidu.com");
        // 执行 js 代码                         距离顶部的距离 越大则越往下
        driver.executeScript("document.documentElement.scrollTop = 500");

        Thread.sleep(2000);
        // 0 则为顶部
        driver.executeScript("document.documentElement.scrollTop = 0");
        Thread.sleep(2000);

        driver.quit();
    }

    public static void main(String[] args) throws InterruptedException {

        AutoDemo4 autoDemo4 = new AutoDemo4();
        autoDemo4.script();
    }
}
